﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using DBLibrary;
using Common;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        KeyDetail kd = PoseidonDBHelper.AdminDB.Select<KeyDetail>(new DBParam("DBPre", this.Session.GetUserDBPrefix()))[0];
        if ((kd.UsageType & KeyUsageType.Temporary) == KeyUsageType.Temporary)
        {
            ConvertImageButton.Visible = true;
            DayLeftLabel.Text = "32";
            this.boysoft.Visible = true;
        }
        else
        {
            ConvertImageButton.Visible = false;
        }
    }

    protected void QuitLinkButton_Click(object sender, EventArgs e)
    {
        Session.RemoveUserDBPrefix();
        FormsAuthentication.SignOut();
    }

    protected void ConvertImageButton_Click(object sender, ImageClickEventArgs e)
    {
         KeyDetail kd = PoseidonDBHelper.AdminDB.Select<KeyDetail>(new DBParam("DBPre", this.Session.GetUserDBPrefix()))[0];
         if ((kd.UsageType & KeyUsageType.Temporary) == KeyUsageType.Temporary)
         {
             this.Response.Redirect("~/pages/ChangeUserTypePage.aspx");
         }
    }
}
